


setup binds for apt :

mount --bind /dev /opt/test/dual_rootfs/dev
mount --bind /dev/pts /opt/test/dual_rootfs/dev/pts


apt update
apt install xorg fastfetch vi

# get open gl:

apt install -y mesa-utils libgl1 libglx-mesa0 libgl1-mesa-dri x11-utils

# 5. Shared memory / IPC x11 neeeeds this & for OpenGL rendering
mount -t tmpfs tmpfs "$CHROOT_PATH/tmp" 2>/dev/null
mount -t tmpfs tmpfs "$CHROOT_PATH/run" 2>/dev/null
mount --bind /dev/shm "$CHROOT_PATH/dev/shm" 2>/dev/null


mount --bind /tmp/.X11-unix /opt/test/dual_rootfs/tmp/.X11-unix 2>/dev/null









cat << 'EOF' > /tmp/start_debian_xfce.sh
#!/bin/sh
# 1. Ensure essential mounts exist
mountpoint -q /opt/test/dual_rootfs/proc || mount -t proc /proc /opt/test/dual_rootfs/proc
mountpoint -q /opt/test/dual_rootfs/sys || mount -t sysfs /sys /opt/test/dual_rootfs/sys
mountpoint -q /opt/test/dual_rootfs/dev || mount --bind /dev /opt/test/dual_rootfs/dev
mountpoint -q /opt/test/dual_rootfs/dev/pts || mount --bind /dev/pts /opt/test/dual_rootfs/dev/pts
mountpoint -q /opt/test/dual_rootfs/dev/shm || mount -t tmpfs -o mode=1777,nosuid,nodev tmpfs /opt/test/dual_rootfs/dev/shm
mountpoint -q /opt/test/dual_rootfs/tmp || mount --bind /tmp /opt/test/dual_rootfs/tmp
mountpoint -q /opt/test/dual_rootfs/var/run || mount --bind /var/run /opt/test/dual_rootfs/var/run

# 2. Launch XFCE with DISPLAY explicitly passed into Debian
exec chroot /opt/test/dual_rootfs /usr/bin/env DISPLAY=:0 /usr/bin/startxfce4
EOF

chmod +x /tmp/start_debian_xfce.sh






[TO FIX SYSTEMD & PSSWD]
# 1. Overwrite the postinst script cleanly (single quotes prevent the ! error)
echo '#!/bin/sh' > /var/lib/dpkg/info/dbus-system-bus-common.postinst
echo 'exit 0' >> /var/lib/dpkg/info/dbus-system-bus-common.postinst
chmod +x /var/lib/dpkg/info/dbus-system-bus-common.postinst

# 2. Tell dpkg to configure everything
dpkg --configure -a



TO GRAB DISPLAY!!!


1. find authority file:

# ps | grep -i x
  118 root     [ext4-dio-unwrit]
  124 root     [ext4-dio-unwrit]
  126 root     [ext4-dio-unwrit]
  128 root     [ext4-dio-unwrit]
  191 root     [wl12xx_wq]
  194 root     [irq/406-wl18xx]
  257 root     [dsx_rebuild_wor]
  260 root     [dsx_exp_workque]
  346 root     {startx} /bin/sh /usr/bin/startx
  369 root     xinit /etc/X11/xinit/xinitrc -- /usr/bin/X :0 -auth /tmp/.serverauth.346 <<<<<<<<<<<This one
  370 root     /usr/bin/X :0 -auth /tmp/.serverauth.346
  413 root     xterm -geometry 80x24+0+0 -name login -sb -fg green -bg black
 1061 jibo-ski dbus-launch --autolaunch 4f895737baecace451b18281386d43a9 --binary-syntax --close-stderr
 6395 root     grep -i x
#


cp /tmp/.serverauth.* /opt/test/dual_rootfs/root/.Xauthority 2>/dev/null




mount -t proc proc /opt/test/dual_rootfs/proc
mount -t sysfs sys /opt/test/dual_rootfs/sys
mount --bind /dev /opt/test/dual_rootfs/dev

# Re-enter chroot
chroot /opt/test/dual_rootfs /bin/bash

===============================================================================================================================================================================
===============================================================================================================================================================================
===============================================================================================================================================================================





